/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package util;

import java.awt.Color;
import java.awt.Component;
import javax.swing.JTable;
import javax.swing.table.DefaultTableCellRenderer;

/**
 *
 * @author Ewerton
 */
public class MyCellRenderer extends DefaultTableCellRenderer{
    
    private Color whiteColor = new Color(254, 254, 254);  
    private Color alternateColor = new Color(204, 204, 204);  
    private Color selectedColor = new Color(61, 128, 223);  
  
    @Override  
    public Component getTableCellRendererComponent(JTable table,  
        Object value, boolean selected, boolean focused, int row,  
        int column) {  
  
            super.getTableCellRendererComponent(table, value, selected, focused, row, column);  
            Color bg;  
            if (!selected)  
                bg = (row % 2 == 0 ? alternateColor : whiteColor);  
            else  
                bg = selectedColor;  
  
            setBackground(bg);  
            setForeground(selected ? Color.white : Color.black);  
  
          /*  if (value instanceof ImageIcon) { 
                setIcon((ImageIcon) value); 
                setText(""); 
            } else 
                setIcon(null); 
          */  
            return this;  
        }   
}
